package com.linkelee.biz.service.sys;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkelee.api.model.sys.SysLog;
import com.linkelee.api.service.sys.ISysLogService;
import com.linkelee.api.util.PageUtils;
import com.linkelee.api.util.Query;
import com.linkelee.biz.mapper.sys.SysLogMapper;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;
@Service("sysLogService")
public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> implements ISysLogService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String key = (String)params.get("key");

        IPage<SysLog> page = this.page(
            new Query<SysLog>().getPage(params),
            new QueryWrapper<SysLog>().like(StringUtils.isNotBlank(key),"username", key)
        );

        return new PageUtils(page);
    }
}
